<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/web/commons/global.jsp"%>

<div class="search-items">
	<c:forEach items="${sources }" var="source">
		<c:choose>
			<c:when test="${source.itemType == 1 }">
				<c:set var="targetUrl" value="${baseUrl }/video/${source.id }.html"></c:set>
			</c:when>
			<c:when test="${source.itemType == 2 }">
				<c:set var="targetUrl" value="${baseUrl }/audio/${source.id }.html"></c:set>
			</c:when>
			<c:when test="${source.itemType == 6 }">
				<c:set var="targetUrl"
					value="${baseUrl }/book/chapter/${source.id }.html"></c:set>
			</c:when>
			<c:when test="${source.itemType == 7 }">
				<c:set var="targetUrl"
					value="${baseUrl }/article/${source.id }.html"></c:set>
			</c:when>
			<c:otherwise>
				<c:set var="targetUrl" value=""></c:set>
			</c:otherwise>
		</c:choose>

		<a href="${targetUrl }" target="_blank">
			<div class="search-item item-type-${source.itemType }">
				<div class="item-top-wrapper">
					<span class="type">【${source.itemName }】</span>
					<c:if test="${not empty source.coverUrl }">
						<img alt="${source.title }" src="${source.coverUrl }"
							class="img-circle" style="width: 20px; height: 20px;">
					</c:if>
					<span class="title">${source.title }</span>
				</div>
				<div class="item-tips-wrapper">
					<time class="tip-time">${source.showTime }</time>
					<div class="clear-both"></div>
				</div>
				<p class="desc hid">
					<c:if test="${not empty source.coverUrl }">
						<img alt="${source.title }" src="${source.coverUrl }"
							class="img-circle" style="width: 100px; height: 100px;">
					</c:if>
					${source.summary }
				</p>
			</div>
		</a>
	</c:forEach>

</div>

<div class="vertical-spacing-30"></div>
<div class="search-pagination-wrapper">
	<div class="content">
		<ul class="pagination page-ul">

			<c:if test="${pagination.index > 1}">
				<li class="page-item"><a href="javascript:;"
					onclick="getSearchList('${param.keywords }',${pagination.index - 1})">&laquo;</a></li>
				<li class="page-item"><a href="javascript:;"
					onclick="getSearchList('${param.keywords }',1)">首页</a></li>
			</c:if>

			<c:forEach begin="${pagination.index }" end="${pagination.index + 7}"
				varStatus="pageStatus">
				<c:if test="${pageStatus.index <= pagination.pages}">
					<c:choose>
						<c:when test="${pageStatus.first }">
							<li class="page-item cur-page"><a href="javascript:;">${pageStatus.index
																}</a></li>
						</c:when>
						<c:otherwise>
							<li class="page-item"><a href="javascript:;"
								onclick="getSearchList('${param.keywords }',${pageStatus.index })">${pageStatus.index
																}</a></li>
						</c:otherwise>
					</c:choose>
				</c:if>
			</c:forEach>

			<c:if test="${pagination.index < pagination.pages}">
				<li class="page-item"
					onclick="getSearchList('${param.keywords }',${pagination.index + 1})"><a
					href="javascript:;">&raquo;</a></li>
				<li class="page-item"
					onclick="getSearchList('${param.keywords }',${pagination.pages} )"><a
					href="javascript:;">尾页</a></li>
			</c:if>

			<!-- 													<li class="page-item has-more"><a href="javascript:;">&hellip;</a></li> -->
		</ul>
	</div>
</div>

<script type="text/javascript">
$(function() {
	$('.search-content-wrapper .search-main-wrapper .search-items .search-item')
			.hover(function() {
				var _this = $(this);
				_this.find(".desc").slideDown();
			}, function() {
				var _this = $(this);
				_this.find(".desc").slideUp();
			});
})
</script>